package com.java46.struts2.admin.action;

import com.java46.struts2.admin.service.AdminService;
import com.java46.struts2.base.action.BaseAction;
import com.java46.struts2.base.exception.BusinessException;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

/**
 *@ClassName AdminAction
 *@Description TODO
 *@Author Administrator
 *@Date 2018/7/22 0022 18:37
 *@Vcrsion 1.0
 **/
@Result(name = "login", location = "/index.jsp")
public class AdminAction extends BaseAction {

    /**
     * @Author xiaobo
     * @Description //管理员登录
     * @Date 18:38 2018/7/22 0022
     * @Param []
     * @return void
     */
    @Action(value ="adminLogin")
    public String adminLogin(){
        String ad_name="";
        String ad_pwd="";
        try {
            ad_name=request.getParameter("ad_name");
            ad_pwd=request.getParameter("ad_pwd");
        }catch (Exception e){
            throw new BusinessException("没有接收到管理员数据");
        }
        AdminService.queryAdmin(ad_name,ad_pwd,request);
        return "login";
    }

}
